package com.tbit.main.service.impl;

import com.tbit.main.dao.core.ParkPointBoundAbnormalDao;
import com.tbit.main.pojo.ParkPointBoundAbnormal;
import com.tbit.main.service.ParkPointBoundAbnormalService;
import com.tbit.main.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author LMY
 * @create 2021-12-22 20:06
 */
@Service("/parkPointBoundAbnormalService")
public class ParkPointBoundAbnormalServiceImpl implements ParkPointBoundAbnormalService {

    @Autowired
    private ParkPointBoundAbnormalDao parkPointBoundAbnormalDao;

    @Override
    public void add(ParkPointBoundAbnormal parkPointBoundAbnormal) {
        parkPointBoundAbnormalDao.add(parkPointBoundAbnormal);
    }

    @Override
    public void del(String machineNO) {
        parkPointBoundAbnormalDao.del(machineNO);
    }

    @Override
    public List<ParkPointBoundAbnormal> getByTypeState(Integer type, Integer state) {
        Map<String, Object> map = new HashMap<>();
        map.put("type", type);
        map.put("state", state);
        return parkPointBoundAbnormalDao.getByTypeState(map);
    }

    @Override
    public void delBatch(List<String> machineNOs) {
        parkPointBoundAbnormalDao.delBatch(StringUtil.getArrayListString(machineNOs));
    }

    @Override
    public void addBatch(List<String> machineNOs, Integer type, Integer state, String time, Integer userMainId, Integer accountId) {
        parkPointBoundAbnormalDao.addBatch(machineNOs, type, state, time, userMainId, accountId);
    }

    @Override
    public List<ParkPointBoundAbnormal> getByMachineNO(List<String> machineNOs, Integer type) {

        Map<String, Object> map = new HashMap<>();
        map.put("machineNOs", StringUtil.getStringListString(machineNOs));
        map.put("type", type);
        return parkPointBoundAbnormalDao.getByMachineNO(map);
    }
}
